/**
 * Created by liguangsong on 16/8/4.
 */
import React from 'react'
import TitleView from './titleView.js'
import TeamAverageView from './teamAverageView.js'
import TeamPlayerView from './teamPlayerView.js'
var getJson = require('../../assist/getJson');

var TeamView = React.createClass({
    getInitialState() {
        var url = 'commonteamroster?LeagueID=00&Season=2015-16&TeamID=' + this.props.params.teamId;
        getJson(url, function (result) {
            this.setState({
                allPlayer: result['resultSets'][0]['rowSet']
            });
        }.bind(this));

        return {
            allPlayer: []
        };
    },


    render() {
        return (
            <div>
                <TitleView city={this.props.params.city} name={this.props.params.name} img={this.props.params.img} mark={this.props.params.mark} conference={this.props.params.conference} division={this.props.params.division} conferenceRank={this.props.params.conferenceRank} divisionRank={this.props.params.divisionRank}/>
                <TeamAverageView  ppg={this.props.params.ppg} rpg={this.props.params.rpg} apg={this.props.params.apg} oppg={this.props.params.oppg}/>
                <TeamPlayerView allPlayer={this.state.allPlayer} teamName={this.props.params.name}/>
            </div>
        );
    }
});

export default TeamView;